package com.resign.carl.command.example1;

import com.resign.carl.command.example1.api.Door;
import com.resign.carl.command.example1.api.Light;
import com.resign.carl.command.example1.api.SimpleRemoteControl;
import com.resign.carl.command.example1.api.impl.GarageDoor;
import com.resign.carl.command.example1.api.impl.GarageDoorOpenCommand;
import com.resign.carl.command.example1.api.impl.LightOnCommand;

/**
 * 命令模式
 * Created by carl.zhao on 2016/6/14.
 */
public class Client {

    public static void main(String[] args) {
        SimpleRemoteControl remoteControl = new SimpleRemoteControl();
        Light light = new Light("客厅");
        LightOnCommand lightOn = new LightOnCommand(light);
        remoteControl.setSlot(lightOn);
        remoteControl.buttonWasPressed();

        Door door = new GarageDoor();
        GarageDoorOpenCommand openCommand = new GarageDoorOpenCommand(door);
        remoteControl.setSlot(openCommand);
        remoteControl.buttonWasPressed();
    }
}
